function block = ami_coding(block, flag)
    if flag == 1 then
        block.outptr(1)(1) = block.z(1) * block.inptr(1)(1);
    end
    
    if flag == 2 then
        if block.inptr(1)(1) == 1
            block.z(1) = block.z(1) * (-1);
        end
    end

endfunction

